﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace OwnZTec.LojaDelivery.UI.WinForms
{
    public partial class FrmRetornoDetalhes : Form
    {
        public string ValorRetorno { get; set; }
        public decimal ValorDevido { get; set; }
        public bool bTotal { get; set; }

        public FrmRetornoDetalhes()
        {
            InitializeComponent();
        }


        private void FrmRetornoDetalhes_Load(object sender, EventArgs e)
        {
            lblValor.Text = ValorDevido.ToString("C2");
            txtValor.Text = ValorDevido.ToString("C2");
        }

        private void rbParcial_CheckedChanged(object sender, EventArgs e)
        {
            if (rbParcial.Checked)
            {
                txtValor.Enabled = true;
                txtValor.Clear();
            }
        }

        private void rbTotal_CheckedChanged(object sender, EventArgs e)
        {
            if (rbTotal.Checked)
            {
                txtValor.Text = ValorDevido.ToString("C2");
                txtValor.Enabled = false;
            }
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            if (!String.IsNullOrEmpty(txtValor.Text.Trim()))
            {
                ValorRetorno = txtValor.Text;
                bTotal = rbTotal.Checked;
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                DialogResult dr;
                dr = MessageBox.Show("Nenhum valor selecionado. Continuar?", "Valor", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dr == DialogResult.Yes)
                    this.DialogResult = DialogResult.Cancel;
                else
                    return;
            }
            this.Close();
        }
    }
}
